import request from "@/utils/request";
import qs from "qs";
//资产扫描 列表
export function fetchList(params) {
  return request({
    url: "/nmap/task/list",
    method: "get",
    params,
  });
}

//资产扫描 扫描结果列表
export function fetchDetailList(params) {
  return request({
    url: "/nmap/record/list",
    method: "get",
    params,
  });
}

//资产扫描 新增扫描
export function assetsScanAdd(data) {
  return request({
    url: "/nmap/task/add",
    method: "post",
    data,
  });
}

//资产扫描编辑扫描
export function assetsScanEdit(data) {
  return request({
    url: "/nmap/task/edit",
    method: "post",
    data,
  });
}

//资产扫描 删除
export function assetsScanDelete(data) {
  return request({
    url: "/nmap/task/remove",
    method: "post",
    data,
  });
}

//资产扫描 关联资产
export function assetsRelation(data, isFormdata) {
  return request({
    url: "/datascan/b/dbinfo/api/add",
    method: "post",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8;multipart/form-data;",
    },
    data: isFormdata ? data : qs.stringify(data),
  });
}

//根据id查详情
export function fetchDataById(params) {
  return request({
    url: "/nmap/task/getInfo",
    method: "get",
    params,
  });
}

//启用停用
export function statusUpdate(data) {
  return request({
    url: "/nmap/task/rescan",
    method: "post",
    data,
  });
}

//历史记录
export function fetchHistoryList(params) {
  return request({
    url: "/nmap/task/getHis",
    method: "get",
    params,
  });
}

//立即执行
export function scanNow(data) {
  return request({
    url: "/nmap/task/scanNow",
    method: "post",
    data,
  });
}
